<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="application/javascript">
    let sec = 3;
    function gotoBaidu() {
        console.log(sec);
        if (sec >= 0) {
            document.write(sec + "秒跳转");
            sec--;
        } else {
            location.href = "https://www.baidu.com/";
        }
    }
    setInterval("gotoBaidu()",1000);
</script>

</body>
</html>